package com.qk.management.mapper;

import com.qk.dto.role.RoleDTO;
import com.qk.entity.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author:zhengbowen
 * @Date: 2025/10/06 18:43
 * @Description:
 */
@Mapper
public interface RoleMapper {
    @Select("update role set name = #{name}, label = #{label}, remark = #{remark}, update_time = #{updateTime} where id = #{id}")
    void updateRole(Role role);

    @Select("select * from role where id = #{id}")
    Role selectRoleById(Integer id);

    @Select("select * from role")
    List<Role> selectRoles();

    @Select("insert into role(name, label, remark, create_time, update_time) values(#{name}, #{label}, #{remark}, #{createTime}, #{updateTime})")
    void insertRole(Role role);

    @Select("delete from role where id = #{id}")
    void deleteRole(Integer id);

    @Select("select label from role where id = #{roleId}")
    String selectRoleLabelByRoleId(Integer roleId);

    List<Role> selectRolesByPage( RoleDTO roleDto);
}
